package me.zk.practice1.hw;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class HWBJJ08 {
    //[[20,16],[15,11],[10,10],[9,10]]
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String[] str = scanner.nextLine().replace("[[","").replace("]]","")
                .split("],\\[");
        List<int[]> list = new ArrayList<>();

        for (int i = 0; i < str.length; i++) {
            String[] s = str[i].split(",");
            int[] r = new int[2];
            r[0] = Integer.parseInt(s[0]);
            r[1] = Integer.parseInt(s[1]);
            list.add(r);
        }
        //排序
        list.sort((o1, o2) -> {
            if (o2[0] > o1[0] || (o1[0]==o2[0]&&o1[1]<o2[1])){
                return 1;
            }
            return -1;
        });

        //
        int max = 0;
        for (int i = 0; i < list.size(); i++) {
            //第一个是最大的长宽
            int[] a = list.get(i);
            int count =1;
            for (int j = i+1; j <list.size() ; j++) {
                int[] b = list.get(j);
                if (a[0]>b[0] && a[1]>b[1]) {
                    count++;
                    a = b;
                }

            }
            max = Math.max(max,count);

        }
        System.out.println(max);

    }
}
